package service;

import dao.StudentDAO;
import dao.Training_ProgramDAO;
import domain.Class_Info;
import domain.Student;

import java.util.List;

/**
 * @author 杨森
 * @date 2022年11月28日 20:13
 */
public class StudentService {
    private StudentDAO studentDAO= new StudentDAO();


    //通过学生的姓名和密码进行登录
    public Student getStudentByNameAndPwd(String s_name, String s_pwd){
        return (Student) studentDAO.querySingle("select * from student where s_name=? and s_pwd=md5(?) ",Student.class,s_name,s_pwd);
    }

    //查询学生的详细信息
    public List<Student> list(){
        return studentDAO.queryMulti("select * from student",Student.class);
    }

    //查询同班的学生
    public List<Student> getClassMates(String s_class){
        return studentDAO.queryMulti("select * from student where s_class=?;",Student.class,s_class);
    }

    //学生课程信息
    public List<Student> stu_Course_List(String s_name){
        return studentDAO.queryMulti("select s_course from student where s_name=?;",Student.class,s_name);
    }


}
